package graphics;

import static org.lwjgl.opengl.GL11.*;

public class Tile {

	public static final int TILE_SIZE = 64;

	public enum Type {
		STONE, GRASS, WALL
	}

	Type type;

	public Tile(Type type) {
		this.type = type;
	}

	public void draw() {
		switch (type) {
		case STONE:
			glColor3f(0.8f, 0.8f, 0.8f);
			break;
		case GRASS:
			glColor3f(0.1f, 0.6f, 0f);
			break;
		case WALL:
			glColor3f(0.3f, 0.3f, 0.3f);
			break;
		}

		glBegin(GL_QUADS);
		{
			glVertex3f(0, 0, 0);
			glVertex3f(0, TILE_SIZE, 0);
			glVertex3f(TILE_SIZE, TILE_SIZE, 0);
			glVertex3f(TILE_SIZE, 0, 0);
		}
		glEnd();
		glColor3f(0, 0, 0);
		glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
		glBegin(GL_QUADS);
		{
			glVertex3f(0, 0, 0);
			glVertex3f(0, TILE_SIZE, 0);
			glVertex3f(TILE_SIZE, TILE_SIZE, 0);
			glVertex3f(TILE_SIZE, 0, 0);
		}
		glEnd();
		glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
	}
}
